package com.bcu.calculus.controller;

import com.bcu.calculus.entity.CheckType;
import com.bcu.calculus.entity.Message;
import com.bcu.calculus.service.CheckTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "20  考勤类型模块")
@RestController
@RequestMapping("/api/CheckType")
public class CheckTypeController {

    @Resource
    private CheckTypeService checkTypeService;

    @ApiOperation(value = "增加")
    @PostMapping(value = "/insertSelective")
    public Message<?> insertSelective(CheckType checkType) {
        return checkTypeService.insertSelective(checkType);
    }


    @ApiOperation(value = "删除")
    @PostMapping(value = "/deleteByPrimaryKey")
    public Message<?> deleteByPrimaryKey(String checkTypeId) {
        return checkTypeService.deleteByPrimaryKey(checkTypeId);
    }


    @ApiOperation(value = "修改")
    @PutMapping(value = "/updateByPrimaryKeySelective")
    public Message updateByPrimaryKeySelective(CheckType checkType) {
        return checkTypeService.updateByPrimaryKeySelective(checkType);
    }


    @ApiOperation(value = "查所有")
    @GetMapping(value = "/selectAll")
    public Message<List<CheckType>> selectAll(){
        return checkTypeService.selectAll();
    }


    @ApiOperation(value = "所属考勤编号查所有")
    @GetMapping(value = "/selectByCAId")
    public Message<List<CheckType>> selectByCAId(String checkAttendanceId){
        return checkTypeService.selectByCAId(checkAttendanceId);
    }


    @ApiOperation(value = "关键字查询")
    @GetMapping(value = "/selectById")
    public Message<List<CheckType>> selectById(String checkTypeId){
        return checkTypeService.selectById(checkTypeId);
    }
}
